{% load i18n %}

{% get_current_language as LANGUAGE_CODE %}

<!DOCTYPE html>
<html lang="{{ LANGUAGE_CODE|default:"zh-hans" }}">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, shrink-to-fit=no, maximum-scale=1, user-scalable=0">
    <meta name="robots" content="noindex,follow">
    <title>{{ ck_finder_api_title|default:"文件浏览" }}</title>
    <style rel="stylesheet" type="text/css">* {
        margin: 0;
        padding: 0;
    }</style>
</head>
<body>
{% load static %}
<script type="text/javascript" src="{% static 'kelove_database/ckfinder/ckfinder.js' %}"></script>
<script type="text/javascript">
    document.title = decodeURIComponent(getQueryString('ck_finder_api_title', '{{ ck_finder_api_title|default:"文件浏览" }}'));
    CKFinder.start({
        displayFoldersPanel: parseInt('{{ ck_finder_api_display_folders_panel|default:1 }}'),
        connectorPath: getQueryString('ck_finder_api_url', '{{ ck_finder_api_url|default:"" }}'),
        skin: getQueryString('ck_finder_api_skin', '{{ ck_finder_api_skin|default:"neko" }}'),
        swatch: getQueryString('ck_finder_api_swatch', '{{ ck_finder_api_swatch|default:"b" }}'),
    });

    function getQueryString(name, value) {
        //获取url中"?"符后的字符串并正则匹配
        let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        let r = window.location.search.substr(1).match(reg);
        if (r) {
            value = r[2];
        }
        return value;
    }
</script>
</body>
</html>